<?php
/*
 * @Author: zls 3292844045@qq.com
 * @Date: 2022-05-26 20:07:34
 * @LastEditors: zls 3292844045@qq.com
 * @LastEditTime: 2022-05-26 20:20:46
 * @FilePath: \CUCCL\php\cart_oper\add.php
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
    include_once('../connect.php');

    $num = $_GET['num'];
    $cart_id = $_GET['cart_id'];

    if($cart_id){
        $sql = "update cart set num = $num + 1 where cart_id = '$cart_id'";
        $data = mysqli_query($conn, $sql);
        $res = [];
        if($data){
            $res['status'] = true;
            $res['msg'] = '添加成功';
        }else{
            $res['status'] = false;
            $res['msg'] = '添加失败';
        }
        
    }else{
        echo('数据传输失败');
    }

    echo(json_encode($res));

?>